<template>
  <div class="container">
    <wechat-account-detail />
  </div>
</template>

<script>
import {
  getWechatAccountsList
} from '@/api/wechatAccounts'
import WechatAccountDetail from './components/WechatAccountDetail'

export default {
  name: 'WechatAccountShow',
  components: {
    WechatAccountDetail
  },
  data() {
    return {
      id: '',
      renderData: {},
      loading: false
    }
  },
  created() {
    const id = this.$route.params && this.$route.params.id
    this.id = id
    this.fetchData(id)
  },
  methods: {
    fetchData(id) {
      getWechatAccountsList({ id }).then(response => {
        const resData = response.data[0]
        console.log(resData)
        this.postForm.id = resData.id
        this.postForm.state = resData.admin
        this.renderData = resData
      }).catch(err => {
        console.log(err)
      })
    },
    toUserEdit() {
      this.$router.push(`/users/edit/${this.id}`)
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 40px;
}
</style>
